
export default function(url, data={}, method='GET',  header={}) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: url,
      data,
      header,
      method,
      timeout:3000,
      success({statusCode, data}) {
        if(~~(statusCode/100) === 2 || ~~(statusCode/100) === 3) {
          resolve(data)
        }else {
          reject({
            statusCode, data
          })
        }
      },
      fail(err) {
        reject(err)
      }
    })
  })
  
}
